home *** CD-ROM | disk | FTP | other *** search
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class TEST_EVM
- --
- -- This is a very important test for the portability
- -- of the SmallEiffel interpretor (command `eval').
- --
-
- creation make
-
- feature
-
- evm: EVAL_VIRTUAL_MACHINE;
-
- make is
- do
- !!evm.make;
- is_true(evm.stack_empty);
- evm.push_integer(1);
- is_true(evm.top_integer = 1);
- evm.pop;
- evm.push_integer(1);
- is_true(evm.top_integer = 1);
- evm.push_integer(-1);
- is_true(evm.top_integer = -1);
- evm.push_character('a');
- is_true(evm.top_character = 'a');
- evm.push_real(3.5);
- is_true(evm.top_real = 3.5);
- evm.push_boolean(true);
- is_true(evm.top_boolean);
- evm.push_double((7.7887).to_double);
- is_true(evm.top_double = (7.7887).to_double);
-
- evm.push_any(Current);
- is_true(evm.top_any = Current);
- ----------------- TIP TOP :-)
- evm.pop;
- is_true(evm.top_double = (7.7887).to_double);
-
- evm.pop;
- is_true(evm.top_boolean);
- evm.pop;
- is_true(evm.top_real = 3.5);
- evm.pop;
- is_true(evm.top_character = 'a');
- evm.pop;
- is_true(evm.top_integer = -1);
- evm.pop;
- is_true(evm.top_integer = 1);
- evm.pop;
- is_true(evm.stack_empty);
- end;
-
- is_true(b: BOOLEAN) is
- do
- cpt := cpt + 1;
- if not b then
- std_output.put_string("TEST_EVM: ERROR Test # ");
- std_output.put_integer(cpt);
- std_output.put_string("%N");
- else
- -- std_output.put_string("Yes%N");
- end;
- end;
-
- cpt: INTEGER;
-
- end -- class TEST_EVM
-